# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')

class JT_0100:
	result = []
	analysisDescription = ["省域ID:", "市县域ID:", "制造商ID:", "终端型号:", "终端ID:", "车牌颜色:", "车辆标识:"]
	analysis0100Length = [2,2,5,20,7,1,8]


	def LogicAisle(self,protocolStr,header):
		count = 0
		str =""
		for i in range(len(self.analysisDescription)):
			if ( i == 2 or i == 3 or i == 4 or i == 6 ):
				try:
					print i,protocolStr[count:count+(self.analysis0100Length[i] * 2)]
					str = protocolStr[count:count+(self.analysis0100Length[i] * 2)].decode("hex").decode('gb2312');
					header.append(self.analysisDescription[i] + str +"\n");
					count = count + self.analysis0100Length[i] * 2;
				except (UnicodeDecodeError,TypeError), e:
					print e
			else:
				header.append(self.analysisDescription[i] + protocolStr[count:count+(self.analysis0100Length[i] * 2)] + "\n");
				count = count + self.analysis0100Length[i] * 2;
		self.result = header

